<?php if(!empty($subvo)){
    $v = $subvo;
    $subvo = '';
}
if(!empty($subsubvo)){
    $v = $subsubvo;
    $subsubvo = '';
}
?>

<div class="viewBox myBox<?php echo $v['id'];?>" <?php if($_SESSION[C('USER_AUTH_KEY')]){?> sortID="<?php echo $v['sort'];?>" modulesID="<?php echo $v['id'];?>" title="<?php echo $v['title'];?>" deleteUrl="<?php echo U('/Admin/Modules/delete',array('id'=>$v['id']));?>" settingUrl="<?php echo U('/Admin/Modules/edit',array('id'=>$v['id']));?>" isEdit="1" editUrl="<?php echo U('/Admin/Window/index',array('modules_id' => $v['id'], 'siteid' => __SITEID__, 'tablename'=>'Nav','fieldlist' => 'title,link,target,sort,icon,img_url','map'=>'modules_id,'.$v['id']));?>"<?php }?>>
  <?php
    if(!empty($v['dataname'])){
        $v['content'] = $v['dataname'];
    }
?>
 
  <div class="nav-glyphicons">
    <ul class="nav-glyphicons-list navbar-fixed-<?php if($v['position'] == 'top' or $v['position'] == 'bottom'){echo $v['position'];}?>" style="background-color:<?php echo $v['backgroundcolor'];?>">
      <?php $dataList = getNavData($v['id']);foreach($dataList as $key => $n){?>
      <?php if(getModulesMultiNavTree($n['id'],'sub') == ''){?>
      <li class="<?php if(count($dataList) == $key + 1){echo 'last';}?><?php if($key == 0){echo 'first';}?>"> <a href="<?php echo $n['link'];?>" <?php if($n['target'] == 1){?>target="_blank"<?php }?>><span class="<?php echo $n['icon'];?>" aria-hidden="true"></span> <span class="glyphicon-class"><?php echo $n['title'];?></span></a></li>
      <?php }else{?>
      <li class="dropdown <?php if(count($dataList) == $key + 1){echo 'last';}?><?php if($key == 0){echo 'first';}?>"> <a href="<?php echo $n['link'];?>" class="dropdown-toggle dropdown<?php echo $v['id'];?>" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="<?php echo $n['icon'];?>" aria-hidden="true"></span> <span class="glyphicon-class"><?php echo $n['title'];?></span></a> <?php echo getModulesMultiNavTree($n['id'],'dropdown-menu'); ?> </li>
      <?php }?>
      <?php }?>
    </ul>
  </div>
  <script>
      $(".dropdown<?php echo $v['id'];?>").on("click", function() {
		 var Swidth = $(window).width();
		 var Ewidth = $(this).width();
		 var Eleft = $(this).offset().left
		 if(Ewidth + Eleft >= Swidth){
			 $(this).next('.dropdown-menu').addClass('dropdown-menu-right');
		 }
    });
	

	

  </script> 
</div>
